package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.ReaderBean;
import com.xuxin.baby.contract.ReaderContract;
import com.xuxin.baby.model.ReaderModel;

/**
 * Created by xu_xin
 * Created on 2020/10/23 0023
 * 文章详情
 */
public class ReaderPresenter implements ReaderContract.Presenter {
    private  final ReaderModel model;
    private final  ReaderContract.View view;

    public ReaderPresenter(ReaderContract.View view) {
        this.view = view;
        model = new ReaderModel();
    }

    @Override
    public void getReader(String tenantId, String token, String readerId) {
        if (null != model) {
            model.getReader(this, tenantId, token, readerId);
        }
    }

    @Override
    public void onSuccess(ReaderBean readerBean) {
        if (null != view) {
            view.onSuccess(readerBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}